﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TextBox.aspx.cs" Inherits="Demo.TextBox" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <title></title>
    <style type="text/css">
        .defaultText
        {
            font-style: italic;
            color: #CCCCCC;
        }
    </style>
    <script type="text/javascript">
        $(document).ready(function () {
            var searchBox = $('#<%=TextBox1.ClientID%>');
            searchBox.focus(
            function () {
                if (searchBox.val() == this.title) {
                    searchBox.removeClass("defaultText");
                    searchBox.val("");
                }
            });
            searchBox.blur(
            function () {
                if (searchBox.val() == "") {
                    searchBox.addClass("defaultText");
                    searchBox.val(this.title);
                }
            });
            searchBox.blur();
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <p>
    </p>
    <div align="center">
        <fieldset style="width: 400px; height: 80px;">
            <p>
                <asp:TextBox ID="TextBox1" Width="200px" CssClass="defaultText" ToolTip="Enter your search keyword here"
                    runat="server"></asp:TextBox>
                <asp:Button ID="btnSubmit" Text="SEARCH" runat="server" /></p>
        </fieldset>
    </div>
    </form>
</body>
</html>
